<div class="row m-n">
    <div class="crumbs-bar">
        <div yb-crumbs></div>
    </div>
    <div tabset type="tab">
        <!-- 1、页面一：列表页 -->
        <div tab heading="发票信息查询" active="activeFlag[0]" ng-click="changeTab(0)">
            <div class="row wrapper-y-sm">
                <!-- <div class="operate-bar col-xs-4 font-0">
                    <button class="btn btn-operate m-r-sm" ng-click="updateSAP()" ng-disabled="!btnPermission.updateSAP"
                        title="{{!btnPermission.updateSAP?'无权限执行此操作':''}}">更新SAP</button>
                </div> -->
                <div class="search-bar wrapper-none col-xs-12">
                    <div class="btn-group m-l-xs pull-right">
                        <button type="button" class="btn btn-default base-color" ng-click="search()" title="刷新">
                            <i class="yb-icon ico-refresh"></i>
                        </button>
                        <button type="button" class="btn btn-default base-color" title="配置表格列"
                            ng-click="switchToolbar('ColConfig');">
                            <i class="yb-icon ico-set"></i>
                        </button>
                        <div class="btn btn-default base-color" ng-if="!!btnPermission.invoiceInfoExport">
                            <div title="导出">
                                <i class="yb-icon ico-export-o"></i>
                            </div>
                            <ul class="more-tool">
                                <li yb-download download-url="exportParam.sectionUrl"
                                    download-param="exportParam.sectionParam" download-key="ids">
                                    <i class="yb-icon ico-export-o"></i> 导出
                                </li>
                                <li yb-download download-url="exportParam.allUrl" download-param="condition" download-duration="3">
                                    <i class="yb-icon ico-export-o"></i> 导出全部
                                </li>
                            </ul>
                        </div>
                    </div>
                    <button class="btn-advance pull-right m-l-xs" ng-click="switchToolbar('AdvanceSearch')">高级搜索
                    </button>
                    <div class="input-group pull-right clearfix">
                        <input type="text" class="form-control txt-search" placeholder="发票编号"
                            ng-model="condition.invoiceNo">
                        <span class="input-group-addon cursor-pointer" ng-click="search(1)">搜索</span>
                    </div>
                </div>
                <div yb-advance-search show-toolbar="toolbarConfig.showAdvanceSearch" search-data="search(1)"
                    reset-data="reset()">
                    <div class="advance-search m-t-sm">
                        <div class="form-group clearfix">
                            <label class="control-label">发票编号：</label>
                            <input type="text" ng-model="condition.invoiceNo" class="form-control">
                        </div>
                        <div class="form-group clearfix">
                            <label class="control-label">纸质发票号：</label>
                            <input type="text" ng-model="condition.paperInvoiceNo" class="form-control">
                        </div>
                        <!-- <div class="form-group clearfix">
                            <label class="control-label">付款方：</label>
                            <input type="text" ng-model="condition.payerOrgName" class="form-control">
                        </div> -->
                        <!-- <div class="form-group clearfix">
                            <label class="control-label">是否签收：</label>
                            <select name="reverseStatus" class="form-control" ng-model="condition.isSign">
                                <option value="">请选择</option>
                                <option value=0>否</option>
                                <option value=1>是</option>
                            </select>
                        </div> -->
                        <!-- <div class="form-group clearfix m-b-none">
                            <label class="control-label">创建时间：</label>
                            <input type="text" class="form-control date-picker" ng-model="condition.createDateStart"
                                datepicker-popup="{{'yyyy-MM-dd'}}" ng-click="showOrderDateStart = !showOrderDateStart"
                                ng-change="checkDate(condition, 'createDateStart', 'createDateEnd')"
                                is-open="showOrderDateStart" close-text="关闭" modal-size="small" readonly>
                        </div>
                        <div class="form-group clearfix m-b-none">
                            <label class="control-label"></label>
                            <label class="control-label wave-line">~</label>
                        </div>
                        <div class="form-group clearfix">
                            <label class="control-label"></label>
                            <input type="text" class="form-control date-picker" ng-model="condition.createDateEnd"
                                datepicker-popup="{{'yyyy-MM-dd'}}" ng-click="showOrderDateEnd = !showOrderDateEnd"
                                ng-change="checkDate(condition, 'createDateStart', 'createDateEnd')"
                                is-open="showOrderDateEnd" close-text="关闭" modal-size="small" readonly>
                        </div>
                        <div class="form-group clearfix m-b-none">
                            <label class="control-label">签收时间：</label>
                            <input type="text" class="form-control date-picker" ng-model="condition.signDateStart"
                                datepicker-popup="{{'yyyy-MM-dd'}}" ng-click="showSignDateStart = !showSignDateStart"
                                ng-change="checkDate(condition, 'signDateStart', 'signDateEnd')"
                                is-open="showSignDateStart" close-text="关闭" modal-size="small" readonly>
                        </div>
                        <div class="form-group clearfix m-b-none">
                            <label class="control-label"></label>
                            <label class="control-label wave-line">~</label>
                        </div>
                        <div class="form-group clearfix">
                            <label class="control-label"></label>
                            <input type="text" class="form-control date-picker" ng-model="condition.signDateEnd"
                                datepicker-popup="{{'yyyy-MM-dd'}}" ng-click="showSignDateEnd = !showSignDateEnd"
                                ng-change="checkDate(condition, 'signDateStart', 'signDateEnd')"
                                is-open="showSignDateEnd" close-text="关闭" modal-size="small" readonly>
                        </div> -->
                    </div>
                </div>
            </div>
            <div yb-col-config show-toolbar="toolbarConfig.showColConfig" ng-model="tableConfig" col-fixed="false"
                has-check-col="true">
            </div>
            <div class="main-area">
                <div yb-table-fixed class="table-fixed-wrap">
                    <div class="th-scroll-x">
                        <table class="table-fixed border-none" width="{{tableConfig.scrollWidth}}">
                            <thead>
                                <tr>
                                    <th width="40" class="text-center th-check border-l-none">
                                        <div yb-check-box yb-checked="markInfo.allChecked" yb-click="selectAll()"></div>
                                    </th>
                                    <th width="50" class="text-center th-check border-l-none">
                                        操作
                                    </th>
                                    <th ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-click="toSort(tableConfig.tableCol, $index)"
                                        ng-show="!!itemCol.isShow">
                                        <div yb-thead-operate ng-model="itemCol" target-width="tableConfig.scrollWidth">
                                        </div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="dataList.length > 0">
                        <table class="table-fixed border-none" width="{{tableConfig.scrollWidth}}">
                            <tbody>
                                <tr ng-repeat="item in dataList track by $index"
                                    ng-class="{'row-selected': $index === markInfo.curRow}"
                                    ng-click="selectRow($index)">
                                    <td width="40" class="text-center border-l-none">
                                        <div yb-check-box yb-checked="item.isChecked" yb-click="selectSingle(item)">
                                        </div>
                                    </td>
                                    <td width="50" class="text-center">
                                        <button type="button" class="btn btn-operate"
                                            ng-disbaled="!btnPermission.invoiceInfoEdit"
                                            ng-click="edit(item, $index)">编辑</button>
                                    </td>
                                    <td class="spill-dots" ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow"
                                        title="{{item[itemCol.dataField]}}">
                                        <div ng-switch="itemCol.type">
                                            <div ng-switch-when="click">
                                                <a class="btn-operate m-r-xs" ng-click="tdClick(item, itemCol.clickFn)">
                                                    {{item[itemCol.dataField]}}
                                                </a>
                                            </div>
                                            <span>{{item[itemCol.dataField]}}</span>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="dataList.length === 0">暂时没有数据</div>
                </div>
            </div>
            <div class="bottom-area page-bar wrapper-y-sm clearfix">
                <div yb-page-info ng-model="pageInfo" yb-refresh="search()"></div>
            </div>
        </div>


        <!-- 2、页面二：查看页 -->
        <div tab heading="详情" active="activeFlag[1]" ng-if="activeFlag[1]">
            <div class="row wrapper-y-sm">
                <div class="search-bar wrapper-none col-xs-12">
                    <div class="btn-group m-l-xs pull-right">
                        <button type="button" class="btn btn-default base-color" ng-click="detailPage.search()"
                            title="刷新">
                            <i class="yb-icon ico-refresh"></i>
                        </button>
                        <button type="button" class="btn btn-default base-color" title="配置表格列"
                            ng-click="detailPage.switchToolbar('ColConfig');">
                            <i class="yb-icon ico-set"></i>
                        </button>
                    </div>
                    <div class="input-group pull-right clearfix">
                        <input type="text" class="form-control txt-search" placeholder="发货通知单单号"
                               ng-model="detailPage.condition.deliveryNoteNo">
                        <span class="input-group-addon cursor-pointer" ng-click="detailPage.search(1)">搜索</span>
                    </div>
                </div>
            </div>
            <div yb-col-config show-toolbar="detailPage.toolbarConfig.showColConfig" ng-model="detailPage.tableConfig"
                col-fixed="false" has-check-col="false"></div>
            <div class="main-area">
                <div yb-table-fixed class="table-fixed-wrap">
                    <div class="th-scroll-x">
                        <table class="table-fixed border-none" width="{{detailPage.tableConfig.scrollWidth}}">
                            <thead>
                                <tr>
                                    <th ng-repeat="itemCol in detailPage.tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}"
                                        ng-click="detailPage.toSort(detailPage.tableConfig.tableCol, $index)"
                                        ng-show="!!itemCol.isShow">
                                        <div yb-thead-operate ng-model="itemCol"
                                            target-width="detailPage.tableConfig.scrollWidth"></div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="detailPage.dataList.length > 0">
                        <table class="table-fixed border-none" width="{{detailPage.tableConfig.scrollWidth}}">
                            <tbody>
                                <tr ng-repeat="item in detailPage.dataList track by $index"
                                    ng-class="{'row-selected': $index === detailPage.markInfo.curRow}"
                                    ng-click="detailPage.selectRow($index)">
                                    <td class="spill-dots"
                                        ng-repeat="itemCol in detailPage.tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow"
                                        title="{{item[itemCol.dataField]}}">
                                        <div ng-switch="itemCol.type">
                                            <div ng-switch-default>
                                                <span>{{item[itemCol.dataField]}}</span>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="detailPage.dataList.length === 0">暂时没有数据</div>
                </div>
            </div>
            <div class="bottom-area page-bar wrapper-y-sm clearfix">
                <div yb-page-info ng-model="detailPage.pageInfo" yb-refresh="detailPage.search()"></div>
            </div>
        </div>


        <!-- 3、页面三：编辑页 -->
        <div tab heading="编辑" active="activeFlag[2]" ng-if="activeFlag[2]">
            <div class="pos-a-full shuttle-box left" style="right: 65%;top: 35px;">
                <div class="box-head clearfix">
                    <span class="font-14">
                        开票信息
                    </span>
                </div>
                <div class="pos-a-full box-body has-head has-foot border-t">
                    <form name="invoiceInfoForm" class="main-wrap form-horizontal form-up-tb p-t clearfix" novalidate>
                        <div class="form-group col-xs-12">
                            <label class="col-xs-3 control-label"><i>*</i>客户名称：</label>
                            <div class="col-xs-8 wrapper-none">
                                <input type="text" name="customerName" class="form-control light-bg"
                                       ng-model="orderObj.customerName" ng-click="selectDealer()" required yb-focus
                                    readonly placeholder="请选择">
                                <div class="msg-block"
                                     ng-show="invoiceInfoForm.customerName.$dirty || (invoiceInfoForm.customerName.$invalid && submitted)">
                                    <div class="error-msg"
                                         ng-if="invoiceInfoForm.customerName.$error.required && !invoiceInfoForm.customerName.focused">
                                        <div class="msg-triangle"></div>
                                        必填项，请填写
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!-- 开票金额：自动计算 第一层div的ng-if条件中orgInfo.isSap===0&&orderObj.customerName&&orderObj.invoicePrice-->
                        <div class="form-group col-xs-12">
                            <label class="col-xs-3 control-label">开票金额：</label>
                            <label class="col-xs-8 control-label p-l-n text-left spill-dots">
                                {{orderObj.amount}}
                            </label>
                        </div>
                        <div class="form-group col-xs-12">
                            <label class="col-xs-3 control-label"><i>*</i>客户是否需要发票：</label>
                            <div class="col-xs-8 control-label p-l-n text-left">
                                <input type="radio" class="m-r-md pull-left" yb-radio ng-model="orderObj.needFlag"
                                    value="1" yb-radio-name="是">
                                <input type="radio" class="m-r-md pull-left" yb-radio ng-model="orderObj.needFlag"
                                    value="0" yb-radio-name="否">
                                <div class="msg-block"
                                     ng-show="invoiceInfoForm.needFlag.$dirty || (invoiceInfoForm.needFlag.$invalid && submitted)">
                                    <div class="error-msg"
                                         ng-if="invoiceInfoForm.needFlag.$error.required && !invoiceInfoForm.needFlag.focused">
                                        <div class="msg-triangle"></div>
                                        必填项，请填写
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group col-xs-12">
                            <label class="col-xs-3 control-label">纸质发票号：</label>
                            <div class="col-xs-8 wrapper-none">
                                <input type="text" name="paperInvoiceNo" class="form-control"
                                       ng-model="orderObj.paperInvoiceNo" maxlength="200">
                            </div>
                        </div>
                        <div class="form-group col-xs-12">
                            <label class="col-xs-3 control-label">快递单号：</label>
                            <div class="col-xs-8 wrapper-none">
                                <input type="text" name="trackingNo" class="form-control"
                                       ng-model="orderObj.trackingNo" maxlength="200">
                            </div>
                        </div>
                    </form>
                </div>
                <div class="bottom-area btn-bar text-center border-t clearfix">
                    <button type="button" class="btn btn-primary m-r-sm" ng-click="saveData(invoiceInfoForm.$valid)">保存
                    </button>
                    <button type="button" class="btn btn-default" ng-click="changeTab(0)">取消</button>
                </div>
            </div>
            <div class="pos-a-full shuttle-box right" style="left: 35%;top: 35px;bottom: 10px">
                <div class="box-head clearfix">
                    <span class="font-14">
                        开票明细
                    </span>
                </div>
                <div class="pos-a-full box-body has-head border-t">
                    <div yb-table-fixed class="table-fixed-wrap" style="top: 15px;left: 0">
                        <div class="th-scroll-x">
                            <table class="table-fixed border-none" width="{{addTableInfo.tableConfig.scrollWidth}}">
                                <thead>
                                    <tr>
                                        <th width="40" class="text-center th-check border-l-none">
                                            <div yb-check-box yb-checked="addTableInfo.markInfo.allChecked"
                                                yb-disabled="orderObj.settleType" yb-click="addTableInfo.selectAll()">
                                            </div>
                                        </th>
                                        <!-- ng-show条件中||(itemCol.isSap&&orgInfo.isSap===0) -->
                                        <th ng-repeat="itemCol in addTableInfo.tableConfig.tableCol track by $index"
                                            width="{{itemCol.width}}"
                                            ng-click="addTableInfo.toSort(addTableInfo.tableConfig.tableCol, $index)"
                                            ng-show="!!itemCol.isShow">
                                            <div yb-thead-operate ng-model="itemCol"
                                                target-width="addTableInfo.tableConfig.scrollWidth"></div>
                                        </th>
                                    </tr>
                                </thead>
                            </table>
                        </div>
                        <div class="td-scroll" ng-show="addTableInfo.dataList.length > 0">
                            <table class="table-fixed border-none" width="{{addTableInfo.tableConfig.scrollWidth}}">
                                <tbody>
                                    <tr ng-repeat="item in addTableInfo.dataList track by $index"
                                        ng-class="{'row-selected': $index === addTableInfo.markInfo.curRow}"
                                        ng-click="addTableInfo.selectRow($index)">
                                        <td width="40" class="text-center border-l-none">
                                            <div yb-check-box yb-checked="item.isChecked"
                                                yb-disabled="orderObj.settleType"
                                                yb-click="addTableInfo.selectSingle(item)"></div>
                                        </td>
                                        <!-- ng-show条件中||(itemCol.isSap&&orgInfo.isSap===0) -->
                                        <td class="spill-dots"
                                            ng-repeat="itemCol in addTableInfo.tableConfig.tableCol track by $index"
                                            width="{{itemCol.width}}" ng-show="!!itemCol.isShow"
                                            title="{{item[itemCol.dataField]}}">
                                            <!-- wangcan：如果需要点击发票通知单跳转页面 -->
                                            <!-- <div ng-switch="itemCol.type">
                                                        <div ng-switch-when="click">
                                                            <a class="btn-operate m-r-xs"
                                                                ng-click="addTableInfo.tdClick(item, itemCol.clickFn)">
                                                                {{item[itemCol.dataField]}}
                                                            </a>
                                                        </div>
                                                        <div ng-switch-default>
                                                            <span>{{item[itemCol.dataField]}}</span>
                                                        </div>
                                                    </div> -->
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                        <div class="no-data w-full text-center p-t" ng-show="addTableInfo.dataList.length === 0">
                            暂时没有数据
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>